const express = require('express')
const msgRouter = require("./router/msg")
const app = express()
app.use(express.urlencoded({ extended: false })) // 现在就方便多了，express的两个方法一执行就行啦
app.use(express.json())
app.use('/msg',msgRouter)
app.use(function (req, res, next) {
  res.cc = function (data, status = 100) {
    res.send({
      status,
      data:data.data,
      message: data.message,
    })
  }
  next()
})
app.listen(3000, () => {
  console.log('http://127.0.0.1:3000')
})
